$(function() {
	$("#loginForm").submit(function() {
		$.ajax({
			url: wxUrl.login,
			type: "post",
			dataType: "json",
			contentType: "application/json",
			data: JSON.stringify({
				"username": $("#username").val(),
				"password": $("#password").val()
			}),
			success: function(resp) {
				// console.log(resp)
				if (resp.code == 0) {
					let token = resp.token
					localStorage.setItem("token", token)
					// console.log("SUCCESS")
					 location.href = "order.html"
					// location.href="payment.html"
					//location.href="front/chart.html"
				}
			}
		})
		return false
	})

	$.ajax({
		url:"https://api.ipify.org/?format=json",
		type:"GET",
		dataType:"json",
		success:function(resp){
			let ip=resp.ip
			localStorage.setItem("ip",ip)
		}
	})
	
})
